home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / programm.ing / winlib.lzh / WINLIB / APPL.C < prev    next >
Encoding:
C/C++ Source or Header  |  1994-03-17  |  4.8 KB  |  206 lines

  1. /********************************************************************
  2.  *                                                                    *
  3.  *    Extended appl_getinfo for WinLIB PRO                            *
  4.  *    Copyright (C) 1994, Bitgate Software and Clever Bits            *
  5.  *                                                                    *
  6.  *    This routine is not intended to replace appl_getinfo for the    *
  7.  *    TOS versions that handle it; it just allows for the usage of an    *
  8.  *    extended type of appl_getinfo for WinLIB PRO as of now.  In        *
  9.  *    short, it provides a substitute for programmers who are using    *
  10.  *    this part of the library for compatibility purposes.            *
  11.  *                                                                    *
  12.  ********************************************************************
  13.  *                                                                    *
  14.  *    Update log:                                                        *
  15.  *        *NONE*                                                        *
  16.  *                                                                    *
  17.  ********************************************************************/
  18.  
  19. #include "winlib.h"
  20. #include "tos.h"
  21.  
  22. APINFO    globapinfo;
  23.  
  24. #ifndef __APPL__
  25. #define __APPL__
  26. #endif
  27.  
  28. /*
  29.  *    Setup appl_getinfo array for TOS<4.0 users
  30.  *    Self explanatory
  31.  */
  32. GLOBAL void WAppl_SetupInfo()
  33. {
  34.     globapinfo.resnum = Getrez();
  35.     globapinfo.colsup = num_colors;
  36.     globapinfo.colicons = 0;
  37.     globapinfo.newrsc = 0;
  38.     globapinfo.langidx = 0;
  39.     globapinfo.multitask = 2;
  40.     globapinfo.extndapfind = 0;
  41.     globapinfo.applsrch = 0;
  42.     globapinfo.rcfix = 0;
  43.     globapinfo.objcxfind = 0;
  44.     globapinfo.menuclick = 0;
  45.     globapinfo.shel_w_r = 0;
  46.     globapinfo.applread = 0;
  47.     globapinfo.shelget = 0;
  48.     globapinfo.mbar1 = 0;
  49.     globapinfo.mbar2 = 0;
  50.     globapinfo.gmouse = 1;
  51.     globapinfo.osmouse = 2;
  52.     globapinfo.submnus = 0;
  53.     globapinfo.popupmnus = 1;
  54.     globapinfo.scrollable = 0;
  55.     globapinfo.exmnsel = 0;
  56.     globapinfo.wf_support = 0;
  57.     globapinfo.wf_gadgets = 0;
  58.     globapinfo.extra_msgs = 0;
  59.     globapinfo.msgbitfld = 0;
  60.     globapinfo.msg_behavior = 0;
  61.     globapinfo.obj3d = 1;
  62.     globapinfo.sysvar = 0;
  63.     globapinfo.tedinfofonts = 0;
  64.     globapinfo.fldial = 1;
  65.     globapinfo.magix = 0;
  66.     globapinfo.cpret = 0;
  67.     globapinfo.wlver = 0x0060;
  68. }
  69.  
  70. /*
  71.  *    Customized appl_getinfo from TOS 4.0+
  72.  *
  73.  *    Called EXACTLY the same way appl_getinfo is called, and all
  74.  *    indices for ap_gtype are the same.  Any 1/0 flags return 2 if
  75.  *    the information is non-standard to TOS, or is different in WinLIB
  76.  *
  77.  *    Returns: FAIL on failure/non-handled codes (TOS < 4.0)
  78.  *             FALSE on any other failure (non-recognized)
  79.  *             TRUE on success
  80.  */
  81. GLOBAL int WAppl_GetInfo(int ap_gtype, int *ap_gout1, int *ap_gout2,
  82.                   int *ap_gout3, int *ap_gout4)
  83. {
  84.     int ret;
  85.  
  86.     *ap_gout1 = 0;
  87.     *ap_gout2 = 0;
  88.     *ap_gout3 = 0;
  89.     *ap_gout4 = 0;
  90.     ret = 0;
  91.  
  92.     if ((AES_VERSION<0x0400) && (ap_gtype > 0)) {
  93.         switch(ap_gtype) {
  94.             case 0:
  95.             case 1:
  96.             case 7:
  97.             case 10:
  98.                 ret = FAIL;
  99.                 break;
  100.  
  101.             case 2:
  102.                 *ap_gout1 = globapinfo.resnum;
  103.                 *ap_gout2 = globapinfo.colsup;
  104.                 *ap_gout3 = globapinfo.colicons;
  105.                 *ap_gout4 = globapinfo.newrsc;
  106.                 ret = TRUE;
  107.                 break;
  108.  
  109.             case 3:
  110.                 *ap_gout1 = globapinfo.langidx;
  111.                 ret = TRUE;
  112.                 break;
  113.  
  114.             case 4:
  115.                 *ap_gout1 = globapinfo.multitask;
  116.                 *ap_gout2 = globapinfo.extndapfind;
  117.                 *ap_gout3 = globapinfo.applsrch;
  118.                 *ap_gout4 = globapinfo.rcfix;
  119.                 ret = TRUE;
  120.                 break;
  121.  
  122.             case 5:
  123.                 *ap_gout1 = globapinfo.objcxfind;
  124.                 *ap_gout2 = 0;
  125.                 *ap_gout3 = globapinfo.menuclick;
  126.                 *ap_gout4 = globapinfo.shel_w_r;
  127.                 ret = TRUE;
  128.                 break;
  129.  
  130.             case 6:
  131.                 *ap_gout1 = globapinfo.applread;
  132.                 *ap_gout2 = globapinfo.shelget;
  133.                 *ap_gout3 = globapinfo.mbar1;
  134.                 *ap_gout4 = globapinfo.mbar2;
  135.                 ret = TRUE;
  136.                 break;
  137.  
  138.             case 8:
  139.                 *ap_gout1 = globapinfo.gmouse;
  140.                 *ap_gout2 = globapinfo.osmouse;
  141.                 ret = TRUE;
  142.                 break;
  143.  
  144.             case 9:
  145.                 *ap_gout1 = globapinfo.submnus;
  146.                 *ap_gout2 = globapinfo.popupmnus;
  147.                 *ap_gout3 = globapinfo.scrollable;
  148.                 *ap_gout4 = globapinfo.exmnsel;
  149.                 ret = TRUE;
  150.                 break;
  151.  
  152.             case 11:
  153.                 *ap_gout1 = globapinfo.wf_support;
  154.                 *ap_gout2 = 0;
  155.                 *ap_gout3 = globapinfo.wf_gadgets;
  156.                 *ap_gout4 = 0;
  157.                 ret = TRUE;
  158.                 break;
  159.  
  160.             case 12:
  161.                 *ap_gout1 = globapinfo.extra_msgs;
  162.                 *ap_gout2 = globapinfo.msgbitfld;
  163.                 *ap_gout3 = globapinfo.msg_behavior;
  164.                 ret = TRUE;
  165.                 break;
  166.  
  167.             case 13:
  168.                 *ap_gout1 = globapinfo.obj3d;
  169.                 *ap_gout2 = globapinfo.sysvar;
  170.                 *ap_gout3 = globapinfo.tedinfofonts;
  171.                 *ap_gout4 = 0;
  172.                 ret = TRUE;
  173.                 break;
  174.  
  175.             case 14:
  176.                 *ap_gout1 = globapinfo.fldial;
  177.                 *ap_gout2 = globapinfo.magix;
  178.                 *ap_gout3 = globapinfo.cpret;
  179.                 *ap_gout4 = 0;
  180.                 ret = TRUE;
  181.                 break;
  182.         }
  183.     }
  184.  
  185.     if ((AES_VERSION>=0x0400) && (ap_gtype<0)) {
  186.         int d1, d2, d3, d4;
  187.  
  188.         ret = appl_getinfo(ap_gtype, &d1, &d2, &d3, &d4);
  189.  
  190.         *ap_gout1 = d1;
  191.         *ap_gout2 = d2;
  192.         *ap_gout3 = d3;
  193.         *ap_gout4 = d4;
  194.     }
  195.  
  196.     if (ap_gtype<0) {
  197.         switch(ap_gtype) {
  198.             case -1:
  199.                 *ap_gout1 = globapinfo.wlver;
  200.                 ret = TRUE;
  201.                 break;
  202.         }
  203.     }
  204.  
  205.     return(ret);
  206. }